package controller

import (
	"github.com/gin-gonic/gin"
	"log"
	"net/http"
	"ruoyi-hello/app/domain"
	"ruoyi-hello/app/sys/service"
	"ruoyi-hello/utils/R"
	"strconv"
)

func SysDictTypePageHandler(context *gin.Context) {

	pageNum, _ := strconv.Atoi(context.DefaultQuery("pageNum", "1"))
	pageSize, _ := strconv.Atoi(context.DefaultQuery("pageSize", "10"))

	var sqlQuery = domain.SearchTableDataParam{
		PageNum:  pageNum,
		PageSize: pageSize,
	}
	result, err := service.DictTypePage(sqlQuery)
	if err.Code != 200 {
		log.Println(err.Err)
		context.JSON(http.StatusOK, R.ReturnFail(err))
		return
	}
	context.JSON(http.StatusOK, R.ReturnSuccess(result))
}
